package org.techmore.hakka;

import org.techmore.common.utils.activity.ActivityUtils;
import org.techmore.common.utils.sound.SoundPoolUtils;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;

public class LanguagePartitionActivity extends Activity {
	
	private LinearLayout visitorSayHello = null;
	private LinearLayout visitorCate = null;
	private LinearLayout visitorCongratulate = null;
	private Button locationShowBack = null;
	
	private ViewGroup.LayoutParams layoutParams = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		ActivityUtils.getInstance().setScreenOrientation(this);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.language_part);
		
		visitorSayHello = (LinearLayout) findViewById(R.id.visitorSayHello);
		visitorCate = (LinearLayout) findViewById(R.id.visitorCate);
		visitorCongratulate = (LinearLayout) findViewById(R.id.visitorCongratulate);
		
	}
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		
		initButtonView();
		
		
		locationShowBack = (Button) findViewById(R.id.locationShowBack);
		
		locationShowBack.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				SoundPoolUtils.getInstance(LanguagePartitionActivity.this).playSound(SoundPoolUtils.SOUND_BUTTON_CLICK);
				LanguagePartitionActivity.this.finish();
			}
		});
		
		
		
		visitorSayHello.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				SoundPoolUtils.getInstance(LanguagePartitionActivity.this).playSound(SoundPoolUtils.SOUND_BUTTON_CLICK);
				ActivityUtils.getInstance().
							leftIN_rightOUT_Transition(LanguagePartitionActivity.this, LanguagePartitionActivity.this, GridPartActivity.class);
			}
		});
		
		
	}





	private void initButtonView() {
		int[] wh = ActivityUtils.getInstance().getWidthHight(this);
		
		int vw = wh[0]/5*4;
		int vh = (wh[1]-80)/4;
		
		layoutParams = visitorSayHello.getLayoutParams();
		layoutParams.height = vh;layoutParams.width = vw;
		visitorSayHello.setLayoutParams(layoutParams);
		
		layoutParams = visitorCate.getLayoutParams();
		layoutParams.height = vh;layoutParams.width = vw;
		visitorCate.setLayoutParams(layoutParams);
		
		layoutParams = visitorCongratulate.getLayoutParams();
		layoutParams.height = vh;layoutParams.width = vw;
		visitorCongratulate.setLayoutParams(layoutParams);
	}
	
}
